<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>客户详情页</title>
<link href="../favicon.ico" rel="shortcut icon"/>
<link rel="stylesheet" type="text/css" href="<%=path%>/timePluls/bootstrap-datetimepicker-master/sample in bootstrap v3/bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="<%=path%>/bc/css/public.css" />
<link rel="stylesheet" type="text/css" href="<%=path%>/bc/css/custom.css" />
<!--自定义控件-->

<link rel="stylesheet" type="text/css" href="<%=path%>/timePluls/bootstrap-datetimepicker-master/css/bootstrap-datetimepicker.min.css">

<!--提示框 -->
<%--     <link rel="stylesheet" type="text/css" href="<%=path%>/bc/css/alert.css" />  --%>
<!--  -->

<!-- 时间控件 -->
<script type="text/javascript" src="<%=path%>/timePluls/jquery-1.11.3.min.js"></script>


<!-- 文件上传 -->
<%-- <script type="text/javascript" src="<%=path%>/timePluls/jquery-form.js"></script> --%>
<link href="<%=path%>/jQueryFiler/css/jquery.filer.css" type="text/css" rel="stylesheet" />
<link href="<%=path%>/jQueryFiler/css/themes/jquery.filer-dragdropbox-theme.css" type="text/css" rel="stylesheet" />

<script src="<%=path%>/jQueryFiler/js/jquery.filer.min.js"></script>
<!--  -->

<script type="text/javascript" src="<%=path%>/timePluls/bootstrap-datetimepicker-master/sample in bootstrap v3/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<%=path%>/timePluls/bootstrap-datetimepicker-master/js/locales/bootstrap-datetimepicker.fr.js"></script>
<script type="text/javascript" src="<%=path%>/timePluls/bootstrap-datetimepicker-master/js/moment-with-locales.js"  ></script>
<script type="text/javascript" src="<%=path%>/timePluls/bootstrap-datetimepicker-master/js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="<%=path%>/timePluls/bootstrap-datetimepicker-master/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>

<!--  -->
<!--  -->
<style type="text/css">
.s_content {
	top: 0;
	left: 0;
	width: 100%;
}
</style>
</head>
<body>
	<div class="s_content m_xwraps" style="overflow: hidden;">
		<input type="hidden" value="${customerID}" id="customerID">
		<div class="m_xcaption">
			当前位置：<span>客户资料></span><em>客户详情页</em>
		</div>
		<div class="m_xinforma"></div>
		<!-- 客户资料扩展信息 -->
		<div id="customer_info_extend">
			<a href="javascript:;" style="font-size: 16px; color: #03a9f4;" onclick="showinfoextend()">更多</a><br>
			<div id="show_customer_info_extend"  style="height: auto;">
			
<!-- 			   <div class="m_xcaption" style="line-height:30px;height: auto;margin:0px 0px 0px;"> -->
<!-- 				   <span style="color:#999999;width: 100px;margin-left: 20px;">指纹</span> -->
<!-- 				   <span style="width: 100px;margin-left: 20px;">指纹>值</span> -->
<!-- 				   <a href="javascript:;" style="color:#03A9F5;margin-left:30px;" onclick="">移除</a> -->
<!-- 			  </div> -->
<!-- 			  <div class="m_xcaption" style="line-height:30px;height: auto;margin:0px 0px 0px;"> -->
<!-- 				   <span style="color:#999999;width: 100px;margin-left: 20px;">指纹</span> -->
<!-- 				   <span style="width: 100px;margin-left: 20px;">指纹>值</span> -->
<!-- 				   <a href="javascript:;" style="color:#03A9F5;margin-left:30px;" onclick="">移除</a> -->
<!-- 			  </div> -->
			</div>
		</div>
		<!--  -->
		<div class="m_xannals">
			<div class="title">历史行为信息</div>
			<div class="m_xhair">
				<p>
					<span>行为</span> <span>活动名</span> <span class="btns">参与情况</span> <span
						class="btns">处理状态</span> <span class="last">渠道</span>
				</p>
			</div>
		</div>
	</div>
	
	<div id = "SavePathForjS" style="display: none;"><%=path%></div>
	<div class="m_xpopups">
		<div class="m_xconsum show" style="margin-top: -100px;">
			<div class="wire"></div>
			<div class="title">
				<i class="J_xclose"><img src="<%=path%>/images/close.png" /></i><span>新建客户</span>
			</div>
			<div class="m_xline" id="nameadd">
				<span>姓名</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入姓名" id="namea"
						name="name" />
				</div>
			</div>
			<div class="m_xline" id="phoneadd">
				<span>手机号</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入手机号" id="phonea"
						name="phone" />
				</div>
			</div>
			<div class="m_xline" id="emailadd">
				<span>邮箱</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入邮箱" id="emaila"
						name="email" />
				</div>
			</div>
			<div class="m_xline" id="companyadd">
				<span>公司</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入公司名称" id="companya"
						name="company" />
				</div>
			</div>
			<div class="m_xline" id="jobadd">
				<span>职位</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入职位" id="joba"
						name="joba" />
				</div>
			</div>
			<div class="m_xline" id="remarksadd">
				<span>备注</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入备注" id="remarksa"
						name="remarks" />
				</div>
			</div>
			<div class="m_xline" id="genderadd">
				<span>性别</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入性别" id="gendera"
						name="remarks" />
				</div>
			</div>
			<div class="m_xline" id="birthdayadd">
				<span>生日</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入生日" id="birthdaya"
						name="birthdaya" />
				</div>
			</div>
			<div class="m_xline" id="weiboadd">
				<span>微博</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入微博" id="weiboa"
						name="weiboa" />
				</div>
			</div>
			<div class="m_xline" id="qqadd">
				<span>QQ</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入QQ" id="qqa"
						name="qqa" />
				</div>
			</div>
			<div class="m_xline" id="wechatadd">
				<span>微信</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入微信" id="wechata"
						name="wechata" />
				</div>
			</div>
			<div class="m_xline" id="addressadd">
				<span>地址</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入地址" id="addressa"
						name="addressa" />
				</div>
			</div>
			<div class="m_xline" id="cityadd">
				<span>城市</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入城市" id="citya"
						name="citya" />
				</div>
			</div>
			<div class="m_xline" id="faxadd">
				<span>传真</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入传真" id="faxa"
						name="faxa" />
				</div>
			</div>
			<div class="m_xline" id="tagadd">
				<span>标签</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入标签" id="taga"
						name="taga" />
				</div>
			</div>
			
			<div id = "fix_html">
			 
			
<!-- 			                        时间控件 -->
<!--                                     <div style="width: 330px;heigth:48px;"> <div class="form-group"> <div class="input-group date" id="datetimepicker11"> -->
<!--                                       <input  name="birthday" type="text" class="form-control" />  -->
<!--                                     <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span></div></div></div>   -->
                          <div class="m_xline" style="display: none;">
			              <span class="datatime"></span>
						  </div>
                                    
			</div>
			<div class="m_xline">
				<span></span>
				<div class="right">
					<a href="javascript:;" class="btns" onclick="updateCustomer()">保 存</a>
				</div>
			</div>
			<div class="m_xline">
				<span></span>
				<div class="right">
					<a href="javascript:;" class="reset J_xreset">重新设计信息项</a>
				</div>
			</div>
		</div>
		<div class="m_xsubunit show">
			<div class="m_xinfos">
			<div class="title">信息组件</div>
				<p class="talk">蓝色只可拖动一次，黑色可拖动多次</p>
				<div class="m_xboxs">
					<p>1、拖动组件中的内容到右侧空白处，会自动成为联系人的信息项</p>
					<ul>
						<li>
						<span class="on">姓名</span>
							<div id="draggable" class="draggable only ">
								<div class="m_xline" id="name">
									<span>姓名</span>
									<div class="right">
										<p class="text" /></p>
									</div>
									<em>移除</em>
								</div>
							</div></li>
						<li><span class="on">性别</span>
							<div id="draggable1" class="draggable only">
								<div class="m_xline" id="gender">
									<span>性别</span>
									<div class="right">
										<p class="text" /></p>
									</div>
									<em>移除</em>
								</div>
							</div></li>
						<li><span class="on">生日</span>
							<div id="draggable2" class="draggable only">
								<div class="m_xline" id="birthday">
									<span>生日</span>
									<div class="right">
										<p class="text" /></p>
									</div>
									<em>移除</em>
								</div>
							</div></li>
						<li><span class="on">手机号</span>
							<div id="draggable3" class="draggable only">
								<div class="m_xline" id="phone">
									<span>手机号</span>
									<div class="right">
										<input type="text" class="text" />
									</div>
									<em>移除</em>
								</div>
							</div></li>
						<li><span class="on">新浪微博</span>
							<div id="draggable4" class="draggable only">
								<div class="m_xline" id="weibo">
									<span>新浪微博</span>
									<div class="right">
										<input type="text" class="text" />
									</div>
									<em>移除</em>
								</div>
							</div></li>
						<li><span class="on">QQ</span>
							<div id="draggable5" class="draggable only">
								<div class="m_xline" id="qq">
									<span>QQ</span>
									<div class="right">
										<input type="text" class="text" />
									</div>
									<em>移除</em>
								</div>
							</div></li>
						<li><span class="on">微信</span>
							<div id="draggable6" class="draggable only">
								<div class="m_xline" id="wechat">
									<span>微信</span>
									<div class="right">
										<input type="text" class="text" />
									</div>
									<em>移除</em>
								</div>
							</div></li>
						<li><span class="on">邮箱</span>
							<div id="draggable7" class="draggable only">
								<div class="m_xline" id="email">
									<span>邮箱</span>
									<div class="right">
										<input type="text" class="text" />
									</div>
									<em>移除</em>
								</div>
							</div></li>
						<li><span class="on">城市</span>
							<div id="draggable8" class="draggable only">
								<div class="m_xline" id="city">
									<span>城市</span>
									<div class="right">
										<input type="text" class="text" />
									</div>
									<em>移除</em>
								</div>
							</div></li>
						<li><span class="on">通讯地址</span>
							<div id="draggable9" class="draggable only">
								<div class="m_xline" id="address">
									<span>通讯地址</span>
									<div class="right">
										<input type="text" class="text" />
									</div>
									<em>移除</em>
								</div>
							</div></li>
						<li><span class="on">公司</span>
							<div id="draggable10" class="draggable only">
								<div class="m_xline" id="company">
									<span>公司</span>
									<div class="right">
										<input type="text" class="text" />
									</div>
									<em>移除</em>
								</div>
							</div></li>
						<li><span class="on">职位</span>
							<div id="draggable11" class="draggable only">
								<div class="m_xline" id="job">
									<span>职位</span>
									<div class="right">
										<input type="text" class="text" />
									</div>
									<em>移除</em>
								</div>
							</div></li>
						<li><span class="on">传真</span>
							<div id="draggable12" class="draggable only">
								<div class="m_xline" id="fax">
									<span>传真</span>
									<div class="right">
										<input type="text" class="text" />
									</div>
									<em>移除</em>
								</div>
							</div></li>
						<li><span class="on">标签</span>
							<div id="draggable13" class="draggable only">
								<div class="m_xline" id="tag">
									<span>标签</span>
									<div class="right">
										<input type="text" class="text" />
									</div>
									<em>移除</em>
								</div>
							</div></li>
												<li><span class="on" style="color: #666; border: 1px dashed #ddd;">备注</span>
													<div id="draggable14" class="draggable only">
														<div class="m_xline" id="remarks">
															<span>备注</span>
															<div class="right">
																<input type="text" class="text" />
															</div>
															<em>移除</em>
														</div>
													</div>
													</li>
					</ul>
				</div>
				<div class="m_xboxs always">
					<p>2、拖动组件中的内容到右侧空白处，会自动成为联系人的内容项</p>
					<ul class="now">
						<li><span>数字</span>
							<div id="draggable15" class="draggable">
								<div class="m_xline">
									<span style="margin-top: 5px;">数字 ></span>
									<div class="right">
									    <div id="数字"  style="display:none"></div>
									    <input id="name_数字"  type="text" class="text" placeholder="控件名(必填)" style="outline: none; border:solid 0px;width: 100px;float: left;color:red;" />
										<input type="number" class="text" disabled="disabled" style="width: 150px;float: right;"/>
									</div>
									<em onclick="removezidingyi(this)">移除</em>
								</div>
							</div></li>
						<li><span>单行文本</span>
							<div id="draggable16" class="draggable">
								<div class="m_xline">
									<span class="changeText" style="margin-top: 5px;">单行 ></span>
									<div class="right">
									    <div id="单行文本"  style="display:none"></div>
									    <input id="name_单行文本" type="text" class="text" placeholder="控件名(必填)" style="outline: none; border:solid 0px;width: 100px;float: left;color:red;" />
										<input type="text" class="text" disabled="disabled"   style="width: 150px;float: right;" />
									</div>
									<em onclick="removezidingyi(this)">移除</em>
								</div>
							</div></li>
						<li><span>多行文本</span>
							<div id="draggable17" class="draggable">
								<div class="m_xline">
									<span class="changeText" style="margin-top: 5px;">多行 ></span>
									<div class="right">
									    <div id="多行文本"  style="display:none"></div>
									    <input id="name_多行文本" type="text" class="text" placeholder="控件名(必填)" style="outline: none; border:solid 0px;width: 100px;float: left;color:red;" />
										<textarea   disabled="disabled" style="width: 150px;float: right;"></textarea>
									</div>
									<em onclick="removezidingyi(this)">移除</em>
								</div>
							</div></li>
						<li><span>单选</span>
							<div id="draggable18" class="draggable">
								<div class="m_xline">
									<span class="changeText" style="margin-top: 5px;">单选 ></span>
									<div class="right">
									    <div id="单选"  style="display:none"></div>
									    <input id="name_单选" type="text" class="text" placeholder="控件名(必填)" style="outline: none; border:solid 0px;width: 100px;float: left;color:red;" />
									    <select name="" class="m_xselect" style="width: 150px;float: right;">
											<option value="">是</option>
											<option value="">否</option>
										</select>
										<textarea  class="text" placeholder="控件值(必填,以逗号隔开)" style="outline: none; border:solid 0px;width:300px;color:red;" ></textarea>
<!-- 										<label -->
<!-- 											style="line-height: 40px; font-size: 14px; font-weight: normal; color: #bdbdbd; margin-right: 10px;"><input -->
<!-- 											type="radio" name="radio" -->
<!-- 											style="margin: 0; margin-right: 5px; vertical-align: 1px;" -->
<!-- 											checked /><span class="changeText">单选</span></label> <label -->
<!-- 											style="line-height: 40px; font-size: 14px; font-weight: normal; color: #bdbdbd; margin-right: 10px;"><input -->
<!-- 											type="radio" name="radio" -->
<!-- 											style="margin: 0; margin-right: 5px; vertical-align: 1px;" /><span -->
<!-- 											class="changeText">单选</span></label> -->
									</div>
									<em onclick="removezidingyi(this)">移除</em>
								</div>
							</div></li>
						<li><span>多选</span>
							<div id="draggable19" class="draggable">
								<div class="m_xline">
									<span style="margin-top: 5px;">多选 ></span>
									<div class="right">
									    <div id="多选"  style="display:none"></div>
									    <input id="name_多选" type="text" class="text" placeholder="控件名(必填)" style="outline: none; border:solid 0px;width: 100px;float: left;color:red;" />
									    <select name="" class="m_xselect" style="width: 150px;float: right;">
											<option value="">样例</option>
											<option value="">样例</option>
											<option value="">样例</option>
											<option value="">样例</option>
											<option value="">样例</option>
											<option value="">样例</option>
											<option value="">样例</option>
										</select>
										<textarea   class="text" placeholder="控件值(必填,以逗号隔开)" style="outline: none; border:solid 0px;width:300px;color:red;" ></textarea>
<!-- 										<label -->
<!-- 											style="line-height: 40px; font-size: 14px; color: #bdbdbd; font-weight: normal; margin-right: 10px;"><input -->
<!-- 											type="checkbox" style="margin: 0; margin-right: 5px;" />多选</label> <label -->
<!-- 											style="line-height: 40px; font-size: 14px; color: #bdbdbd; font-weight: normal; margin-right: 10px;"><input -->
<!-- 											type="checkbox" style="margin: 0; margin-right: 5px;" />多选</label> <label -->
<!-- 											style="line-height: 40px; font-size: 14px; color: #bdbdbd; font-weight: normal; margin-right: 10px;"><input -->
<!-- 											type="checkbox" style="margin: 0; margin-right: 5px;" />多选</label> <label -->
<!-- 											style="line-height: 40px; font-size: 14px; color: #bdbdbd; font-weight: normal; margin-right: 10px;"><input -->
<!-- 											type="checkbox" style="margin: 0; margin-right: 5px;" />多选</label> <label -->
<!-- 											style="line-height: 40px; font-size: 14px; color: #bdbdbd; font-weight: normal; margin-right: 10px;"><input -->
<!-- 											type="checkbox" style="margin: 0; margin-right: 5px;" />多选</label> -->
									</div>
									<em onclick="removezidingyi(this)">移除</em>
								</div>
							</div></li>
						<li><span>下拉列表</span>
							<div id="draggable20" class="draggable">
								<div class="m_xline">
									<span style="margin-top: 5px;" >下拉 ></span>
									<div class="right">
									    <div id="下拉列表"  style="display:none"></div>
									    <input id="name_下拉列表" type="text" class="text" placeholder="控件名(必填)" style="outline: none; border:solid 0px;width: 100px;float: left;color:red;" />
									    <select name="" class="m_xselect" style="width: 150px;float: right;">
											<option value="">样例</option>
											<option value="">样例</option>
											<option value="">样例</option>
											<option value="">样例</option>
											<option value="">样例</option>
										</select>
										<textarea   class="text" placeholder="控件值(必填,以逗号隔开)" style="outline: none; border:solid 0px;width:300px;color:red;" ></textarea>
									</div>
									<em onclick="removezidingyi(this)">移除</em>
								</div>
							</div></li>
							                 
						<li><span>日期</span>
							<div id="draggable21" class="draggable">
								<div class="m_xline">
									<span style="margin-top: 5px;">日期 ></span>
									<div class="right">
									 <div id="日期"  style="display:none"></div>
									   <input id="name_日期" type="text" class="text" placeholder="控件名(必填)" style="outline: none; border:solid 0px;width: 100px;float: left;color:red;" />
										<input type="text" class="text" style="width: 150px;float: right;"/>
						            </div>
									<em onclick="removezidingyi(this)">移除</em>
								</div>
							</div></li>
							
							
						<li><span>评分</span>
							<div id="draggable22" class="draggable">
								<div class="m_xline">
									<span style="margin-top: 5px;">评分 ></span>
									<div class="right">
									    <div id="评分"  style="display:none"></div>
									    <input id="name_评分" type="text" class="text" placeholder="控件名(必填)" style="outline: none; border:solid 0px;width: 100px;float: left;color:red;" />
										<div class="m_xstra lsg" style="width: 150px;float: right;">
											<img src="<%=path%>/images/star_2.png"
												onclick="pfClick(this)" style="width: 13px;"
												class="unSelect"> <img
												src="<%=path%>/images/star_2.png" onclick="pfClick(this)"
												style="width: 13px;" class="unSelect"> <img
												src="<%=path%>/images/star_2.png" onclick="pfClick(this)"
												style="width: 13px;" class="unSelect"> <img
												src="<%=path%>/images/star_2.png" onclick="pfClick(this)"
												style="width: 13px;" class="unSelect"> <img
												src="<%=path%>/images/star_2.png" onclick="pfClick(this)"
												style="width: 13px;" class="unSelect">
											<dfn class="pfText">0.0分</dfn>
											<input type="text" value="" style="display: none;" class="pf" />
										</div>
									</div>
									<em onclick="removezidingyi(this)">移除</em>
								</div>
							</div></li>
						<li><span>图片</span>
							<div id="draggable23" class="draggable">
								<div class="m_xline">
									<span style="margin-top: 5px;">图片 ></span>
									<div class="right">
									        <div id="图片"  style="display:none"></div>
									        <input id="name_图片" type="text" class="text" placeholder="图片控件名(必填)" style="outline: none; border:solid 0px;width: 100px;float: left;color:red;" />
<!-- 										<b>上传图片<input type="file"></b> -->
											<input type="file" style="width: 150px;float: right;">
									</div>
									<em onclick="removezidingyi(this)">移除</em>
								</div>
							</div></li>
						<li><span>分割线</span>
							<div id="draggable24" class="draggable">
								<div class="m_xline">
								 <div id="分割线"  style="display:none"></div>
									<span class="line"></span> <em onclick="removezidingyi(this)">移除</em>
								</div>
							</div></li>
						<li><span>附件</span>
							<div id="draggable25" class="draggable">
								<div class="m_xline">
									<span style="margin-top: 5px;">附件 ></span>
									<div class="right">
									        <div id="附件"  style="display:none"></div>
										    <input id="name_附件" type="text" class="text" placeholder="上传控件名(必填)" style="outline: none; border:solid 0px;width: 100px;float: left;color:red;" />
<!-- 										<b>上传<input type="file"></b> -->
											<input type="file" style="width: 150px;float: right;">
									</div>
									<em onclick="removezidingyi(this)">移除</em>
								</div>
							</div></li>
					</ul>
				</div>
			</div>
			<div class="m_xinfos z_long">
				<div class="title none">
					<i><img src="<%=path%>/images/close.png"  class="q_close"></i>定义客户资料组件
				</div>
				<p class="talk">从头开始创建客户资料组件</p>
				<div class="m_xforms" style="width: 440px;">
					<form class="ui-widget-header" id="droppable"></form>
				</div>
				<div class="m_xbutton">
					<a href="javascript:;" onclick="add()">生效表单</a> <a
						href="javascript:;" class="white  q_close">取消</a>
				</div>
			</div>
		</div>
	</div>
</body>
<%-- 	<script type="text/javascript" src="<%=path%>/bc/bootstarp/js/jquery.min.js"></script> --%>
<%-- 	<script type="text/javascript" src="<%=path%>/js/jquery.min.js"></script> --%>
	<script type="text/javascript" src="<%=path%>/js/customrList.js"></script>
	<script type="text/javascript" src="<%=path%>/js/echarts.common.min.js"></script>
	<script type="text/javascript" src="<%=path%>/js/custom.js"></script>
	<script type="text/javascript" src="<%=path%>/js/jquery-ui.js"></script>
	<script type="text/javascript" src="<%=path%>/js/drop.js"></script>
	<script type="text/javascript" src="<%=path%>/js/Sortable.js"></script>
	<script type="text/javascript" src="<%=path%>/js/app_copy.js"></script>
	<script type="text/javascript" src="<%=path%>/js/ajaxfileupload.js"></script>
<script type="text/javascript">

/* 自定义控件 */
//移除传递过来的控件
	function removezidingyi(e){
		$(e).parents('.m_xline').remove();
        var	type=$(e).parents('.m_xline').find('.right').find('div').attr("id");
       if (($("#name_"+type).attr("value"))!=null&&( $("#name_"+type).attr("value"))!="") {
    	   $("#name_"+type).attr("value","");
	   }
        if (($('.m_xboxs,.always>.now>.li>.m_xline>.right').find('div[id='+type+']').parents('.right').find('textarea').text())!=null&&($('.m_xboxs,.always>.now>.li>.m_xline>.right').find('div[id='+type+']').parents('.right').find('textarea').text())!="") {
        	 $('.m_xboxs,.always>.now>.li>.m_xline>.right').find('div[id='+type+']').parents('.right').find('textarea').text("");
		}
        
        
	}
	
	/* 时间控件全局变量 */
	var datadpid="";
	/* 上传控件全局变量 */
	var uploadpid="";
	/*  */
	
	//新建客户，编辑客户调用方法（打开窗口初始化控件结构）
	function  ShowArchitecture(){
		
		$("#nameadd").hide();
		$("#phoneadd").hide();
		$("#emailadd").hide();
		$("#companyadd").hide();
		$("#jobadd").hide();
		$("#remarksadd").hide();
		$("#genderadd").hide();
		$("#birthdayadd").hide();
		$("#weiboadd").hide();
		$("#qqadd").hide();
		$("#wechatadd").hide();
		$("#addressadd").hide();
		$("#cityadd").hide();
		$("#faxadd").hide();
		$("#tagadd").hide();
		
		 $.ajax({
       		  url: "<%=path%>/api/ComponentStructure/Show_ComponentStructure",

       		  type: "post",
       		  
       		  async: false,

       		  data:{},

       		  dataType: "json",

       		  timeout: 1000,

       		  error: function(){},

       		  success: function(data){
       			
                if (data.status == 200) {
                	var showhtml ="";
                	console.log(data.list);
                	var returndata = data.list;
                	for (var int = 0; int < returndata.length; int++) {
                		console.log(returndata[int].textNameType);
						var type = returndata[int].textNameType;
						var name = returndata[int].textNameKey;
						
					  if (type!=null&&type!=""&&name!=null&&name!="") {
						
					    if (type=="FristType") {
					    	$('#' + name + 'add').show();
						}
					    if (type=="数字") {
					    	//拼装显示控件
							showhtml +='<div class="m_xline">'+
							'<span class="datatime">'+name+'</span>'+
							'<div class="right">'+
							'<div id="TypeId'+name+'" style="display:none">数字</div>'+
							'<div id="'+name+'" style="display:none">'+name+'</div>'+
							'<input type="number" class="text"  id = "fix_'+name+'" name="fix_'+name+'" />'+
							'</div>'+
							'</div>';
						}
					    if (type=="单行文本") {
					    	showhtml +='<div class="m_xline">'+
								'<span class="datatime">'+name+'</span>'+
								'<div class="right">'+
								'<div id="TypeId'+name+'" style="display:none">单行文本</div>'+
								'<div id="'+name+'" style="display:none">'+name+'</div>'+
								'<input type="text" class="text" placeholder="请输入'+name+'" id = "fix_'+name+'" name="fix_'+name+'" />'+
								'</div>'+
								'</div>';
						}
					    if (type=="多行文本") {
					    	showhtml +='<div class="m_xline">'+
								'<span class="datatime">'+name+'</span>'+
								'<div class="right">'+
								'<div id="TypeId'+name+'" style="display:none">多行文本</div>'+
								'<div id="'+name+'" style="display:none">'+name+'</div>'+
								'<textarea type="text" class="text" placeholder="请输入'+name+'" id = "fix_'+name+'" name="fix_'+name+'" ></textarea>'+
								'</div>'+
								'</div>';
							
						}
						 if (type=="单选") {
							var showselect = "";
							var  final_val =returndata[int].textNameVals.split(",");
								if (final_val.length>0) {
									for (var n = 0; n < final_val.length; n++) {
										showselect+='<option value="'+final_val[n].trim()+'">'+final_val[n].trim()+'</option>';
									}
								}
							 
							 showhtml +='<div class="m_xline">'+
								'<span class="datatime">'+name+'</span>'+
								'<div class="right">'+
								'<div id="TypeId'+name+'" style="display:none">单选</div>'+
								'<div id="'+name+'" style="display:none">'+name+'</div>'+
								'<select style="height:48px;width:330px;font-size:14px;" id = "fix_'+name+'" name="fix_'+name+'" class="m_xselect " > '+showselect+'</select>'+
								'</div>'+
								'</div>';				
							}
						 if (type=="多选") {
							 
							    var showselect = "";
							    var  final_val1 =returndata[int].textNameVals.split(",");
							if (final_val1.length>0) {
								for (var n = 0; n < final_val1.length; n++) {
									showselect+='<option value="'+final_val1[n].trim()+'">'+final_val1[n].trim()+'</option>';
								}
							}
							 
							 showhtml +='<div class="m_xline">'+
								'<span class="datatime">'+name+'</span>'+
								'<div class="right">'+
								'<div id="TypeId'+name+'" style="display:none">多选</div>'+
								'<div id="'+name+'" style="display:none">'+name+'</div>'+
								'<select style="height:48px;width:330px;font-size:14px;"  multiple="multiple"  id = "fix_'+name+'" name="fix_'+name+'" class="m_xselect" >'+
								showselect+
								'</select>'+
								'</div>'+
								'</div>';
							}
						 if (type=="下拉列表") {
							 
							  var showselect = "";
							  var  final_val1 =returndata[int].textNameVals.split(",");
							if (final_val1.length>0) {
								for (var n = 0; n < final_val1.length; n++) {
									showselect+='<option value="'+final_val1[n].trim()+'">'+final_val1[n].trim()+'</option>';
								}
							}
							 
							showhtml +='<div class="m_xline">'+
								'<span class="datatime">'+name+'</span>'+
								'<div class="right">'+
								'<div id="TypeId'+name+'" style="display:none">下拉列表</div>'+
								'<div id="'+name+'" style="display:none">'+name+'</div>'+
								'<select style="height:48px;width:330px;font-size:14px;"  id = "fix_'+name+'" name="fix_'+name+'" class="m_xselect" >'+
								showselect+
								'</select>'+
								'</div>'+
								'</div>';
							}
						 if (type=="日期") {
							 
							 
							 showhtml +='<div >'+
								'<span class="datatime" style="width: 20%;margin-top: 8px;float: left;text-align: right;margin-left: -19px;font-size:14px;">'+name+'</span>'+
								'<div class="right">'+
								'<div id="TypeId'+name+'" style="display:none">日期</div>'+
								'<div id="'+name+'" style="display:none">'+name+'</div>'+
								    '<div style="width: 330px;heigth:48px;margin-left:90px;">'+
								         '<div class="form-group"> '+
								               '<div class="input-group date" id="Time2_'+name+'">'+
                                                '<input  id = "fix_'+name+'" name="fix_'+name+'" type="text" class="form-control" /> '+
                                                '<span class="input-group-addon">'+
                                                       '<span class="glyphicon glyphicon-calendar">'+
                                                       '</span>'+
                                                '</span></div></div></div> '+
                             '</div>'+
								'</div>';
								
							 datadpid +="#Time2_"+name+",";
								
							}
						 if (type=="评分") {
							 
							 
							 
							 showhtml +='<div class="m_xline">'+
								'<span class="datatime">'+name+'</span>'+
								'<div class="right">'+
								'<div id="TypeId'+name+'" style="display:none">评分</div>'+
								'<div id="'+name+'" style="display:none">'+name+'</div>'+
//								
								'<div class="m_xstra lsg" style="width: 150px;">'+
								'<img src="<%=path%>/images/star_2.png" '+
									'onclick="pfClick(this)" style="width: 13px;" '+
									'class="unSelect"> <img '+
									'src="<%=path%>/images/star_2.png" onclick="pfClick(this)" '+
									'style="width: 13px;" class="unSelect"> <img  '+
									'src="<%=path%>/images/star_2.png" onclick="pfClick(this)" '+
									'style="width: 13px;" class="unSelect"> <img '+
									'src="<%=path%>/images/star_2.png" onclick="pfClick(this)"  '+
									'style="width: 13px;" class="unSelect"> <img '+
									'src="<%=path%>/images/star_2.png" onclick="pfClick(this)"  '+
									'style="width: 13px;" class="unSelect">  '+
								'<dfn class="pfText">0.0分</dfn>  '+
								'<input type="text" id = "fix_'+name+'" name="fix_'+name+'" style="display: none;" class="pf" /> '+
						     	'</div>  '+
								
								'</div>'+
								'</div>';
							}
						 
						 if (type=="图片") {
							 showhtml +='<div class="m_xline">'+
								'<span class="datatime">'+name+'</span>'+
								'<div class="right">'+
								'<div id="TypeId'+name+'" style="display:none">图片</div>'+
								'<div id="'+name+'" style="display:none">'+name+'</div>'+
								'<form id="file_'+name+'" enctype="multipart/form-data" >'+
								
								'<div style="height: 100px;width: 100px;">'+
								'<div style="width:100px;height:100px; position:relative;float:left;margin-left:4px;">'+
								'<img id="img4'+name+'" src="<%=path%>/bm/images/img_p.png" style="width:100px;height:100px;" >'+
								'</div>'+
								'<input type="file" accept="image/gif,image/jpeg,image/x-png" id = "fix_'+name+'" name="fix_'+name+'" onchange="showphoto(\''+name+'\')" '+
								' style="cursor:pointer;height:100px;width: 100px;filter: alpha(opacity = 50); -moz-opacity: 0.5; -khtml-opacity: 0.5; opacity: 0.0;'+
								 'position: absolute; z-index: 99;">'+
								'</div>'+
								
								'</form>'+
								'</div>'+
								'</div>';
							
							}
						 if (type=="分割线") {
							 showhtml +='<div class="m_xline">'+
								'<span class="datatime">'+name+'</span>'+
								'<div class="right">'+
								'<div id="TypeId'+name+'" style="display:none">分割线</div>'+
								'<div id="'+name+'" style="display:none">'+name+'</div>'+
								'<span style="display: inline-block;width: 342px;height: 20px;border-bottom: 1px dashed #ddd;margin-left: 18px;"></span>'+
								'</div>'+
								'</div>';
							}
						 if (type=="附件") {
								
							 
							 showhtml +='<div class="m_xline">'+
								'<span class="datatime">'+name+'</span>'+
								'<div class="right">'+
								'<div id="TypeId'+name+'" style="display:none">附件</div>'+
								'<div id="'+name+'" style="display:none">'+name+'</div>'+
								'<form id="realfile_'+name+'" enctype="multipart/form-data" >'+
								
//								'<input type="file" id = "fix_'+arrayob[1].trim()+'" name="fix_'+arrayob[1].trim()+'" />'+
								'<div id="fileremove'+name+'" name="have">'+
								'<input type="file" name="fix_'+name+'" id = "fix_'+name+'" >'+
								'</div>'+
								'</form>'+
								'</div>'+
								'</div>';
								
							 uploadpid +="#fix_"+name+",";	
							}
						}
                	}
                	//拼接所有文本
   				 $('.m_xpopups>.m_xconsum>#fix_html').html(showhtml);
                
                }
       		  }
       		  
       		  }); 
		
	}
	
	$(function(){
		
		//取消清空自定义控件div
		$('.q_close').click(function(){
			//$('#droppable>div').remove();
			$('#droppable>div').each(function(e,data){
				
				if (($(data).attr("id"))!=null&&($(data).attr("id"))!="") {
					 var val = 	$(data).attr("id");
					 //console.log("取消时还原状态"+val);
					 val = "#"+val;
					 reflashstatus(val);
				}
			
			});
			
			$('.m_xsubunit').removeClass('show'); 
			$('.m_xpopups').removeClass('show');  
		});
		
		
		$('.J_xreset').click(function(){
			var $this = $(this);
			
// 			$('#droppable>div').remove();
			
			/*
			 * ZHIWEN  
			 * @description 移动存在数据进打开的页面
			 */
			 //遍历判断自定义控件中是否已经有了该名字控件
			 var have_id = "";
			   $('#droppable > div').each(function(m, data2) {
				have_id += $(data2).attr('id')+",";
			  });
				/*
				 * ZHIWEN  
				 * @description 移动存在数据进打开的页面
				 */
				var html = "";
				
				$('.m_xpopups>.m_xconsum>.m_xline').each(function(i,data){
					
				if (($(data).css("display"))!="none") {
					
				 var id =	$(data).find('.right').find('input').attr("id");
				 //var val = $(data).find('.right').find('input').val();
						
							if ((have_id.indexOf(id))>0) {
								console.log("控件已存在");
							} else {
			
	
									if (id=="namea") {
										
										$('#draggable').addClass('ui-draggable-disabled');
										$('#draggable').parent('li').find('span').removeClass('on');
										$('#draggable').parent('li').find('span').addClass('gary');
										$('#draggable').draggable("disable");
										html +='<div class="m_xline" id="name">'+
										'<span>姓名</span> '+
										'<div class="right"> '+
											'<p class="text" /></p> '+
										'</div> '+
										'<em onclick="last_remove(\''+"name"+'\')" >移除</em> '+
									    '</div> ';
										
									}
							        if (id=="phonea") {
							        	$('#draggable3').addClass('ui-draggable-disabled');
										$('#draggable3').parent('li').find('span').removeClass('on');
										$('#draggable3').parent('li').find('span').addClass('gary');
										$('#draggable3').draggable("disable");
							        	html +='<div class="m_xline" id="phone"> '+
										'<span>手机号</span> '+
										'<div class="right">'+
											'<input type="text" class="text" />'+
										'</div>'+
										'<em onclick="last_remove(\''+"phone"+'\')" >移除</em>'+
									   '</div>	';
									}
							        if (id=="emaila") {
							        	$('#draggable7').addClass('ui-draggable-disabled');
										$('#draggable7').parent('li').find('span').removeClass('on');
										$('#draggable7').parent('li').find('span').addClass('gary');
										$('#draggable7').draggable("disable");
							        	html +='<div class="m_xline" id="email">'+
										'<span>邮箱</span>'+
										'<div class="right">'+
											'<input type="text" class="text" />'+
										'</div>'+
										'<em onclick="last_remove(\''+"email"+'\')" >移除</em>'+
									     '</div>';
									}
							        if (id=="companya") {
							        	$('#draggable10').addClass('ui-draggable-disabled');
										$('#draggable10').parent('li').find('span').removeClass('on');
										$('#draggable10').parent('li').find('span').addClass('gary');
										$('#draggable10').draggable("disable");
							        	html +='<div class="m_xline" id="company">'+
										'<span>公司</span>'+
										'<div class="right">'+
											'<input type="text" class="text" />'+
										'</div>'+
										'<em onclick="last_remove(\''+"company"+'\')" >移除</em>'+
									   '</div>';
									}
							        if (id=="joba") {
							        	$('#draggable11').addClass('ui-draggable-disabled');
										$('#draggable11').parent('li').find('span').removeClass('on');
										$('#draggable11').parent('li').find('span').addClass('gary');
										$('#draggable11').draggable("disable");
							        	html +='<div class="m_xline" id="job">'+
										'<span>职位</span>'+
										'<div class="right">'+
											'<input type="text" class="text" />'+
										'</div>'+
										'<em onclick="last_remove(\''+"job"+'\')" >移除</em>'+
									    '</div>';
									}
							        if (id=="remarksa") {
							        	$('#draggable14').addClass('ui-draggable-disabled');
										$('#draggable14').parent('li').find('span').removeClass('on');
										$('#draggable14').parent('li').find('span').addClass('gary');
										$('#draggable14').draggable("disable");
							        	html +='<div class="m_xline" id="remark">'+
										'<span>备注</span>'+
										'<div class="right">'+
											'<input type="text" class="text" />'+
										'</div>'+
										'<em onclick="last_remove(\''+"remark"+'\')" >移除</em>'+
									    '</div>';
									}
							        /*  */
							        if (id=="gendera") {
							        	$('#draggable1').addClass('ui-draggable-disabled');
										$('#draggable1').parent('li').find('span').removeClass('on');
										$('#draggable1').parent('li').find('span').addClass('gary');
										$('#draggable1').draggable("disable");
							        	html += '<div class="m_xline" id="gender">'+
										'<span>性别</span> '+
										'<div class="right"> '+
											'<p class="text" /></p> '+
										'</div> '+
										'<em onclick="last_remove(\''+"gender"+'\')">移除</em> '+
									    '</div> ';
									}
							        
							        if (id=="birthdaya") {
							        	$('#draggable2').addClass('ui-draggable-disabled');
										$('#draggable2').parent('li').find('span').removeClass('on');
										$('#draggable2').parent('li').find('span').addClass('gary');
										$('#draggable2').draggable("disable");
							        	html += '<div class="m_xline" id="birthday">'+
										'<span>生日</span>'+
										'<div class="right">'+
											'<p class="text" /></p>'+
										'</div>'+
										'<em onclick="last_remove(\''+"birthday"+'\')" >移除</em>'+
									    '</div>';
									}
							        if (id=="weiboa") {
							        	$('#draggable4').addClass('ui-draggable-disabled');
										$('#draggable4').parent('li').find('span').removeClass('on');
										$('#draggable4').parent('li').find('span').addClass('gary');
										$('#draggable4').draggable("disable");
							        	html += '<div class="m_xline" id="weibo">'+
										'<span>新浪微博</span>'+
										'<div class="right">'+
											'<input type="text" class="text" />'+
										'</div>'+
										'<em onclick="last_remove(\''+"weibo"+'\')">移除</em>'+
									    '</div>';
									}
							        if (id=="qqa") {
							        	$('#draggable5').addClass('ui-draggable-disabled');
										$('#draggable5').parent('li').find('span').removeClass('on');
										$('#draggable5').parent('li').find('span').addClass('gary');
										$('#draggable5').draggable("disable");
							        	html += '<div class="m_xline" id="qq">'+
										'<span>QQ</span>'+
										'<div class="right">'+
											'<input type="text" class="text" />'+
										'</div>'+
										'<em onclick="last_remove(\''+"qq"+'\')">移除</em>'+
									   '</div>';
									}
							        if (id=="wechata") {
							        	$('#draggable6').addClass('ui-draggable-disabled');
										$('#draggable6').parent('li').find('span').removeClass('on');
										$('#draggable6').parent('li').find('span').addClass('gary');
										$('#draggable6').draggable("disable");
							        	html += '<div class="m_xline" id="wechat">'+
										'<span>微信</span>'+
										'<div class="right">'+
											'<input type="text" class="text" />'+
										'</div>'+
										'<em onclick="last_remove(\''+"wechat"+'\')">移除</em>'+
									   '</div>';
									}
							        if (id=="addressa") {
				                    	$('#draggable9').addClass('ui-draggable-disabled');
										$('#draggable9').parent('li').find('span').removeClass('on');
										$('#draggable9').parent('li').find('span').addClass('gary');
										$('#draggable9').draggable("disable");
				                    	html +='<div class="m_xline" id="address">'+
										'<span>通讯地址</span>'+
										'<div class="right">'+
											'<input type="text" class="text" />'+
										'</div>'+
										'<em  onclick="last_remove(\''+"address"+'\')">移除</em>'+
									    '</div>';
									}
							        if (id=="citya") {
				                    	$('#draggable8').addClass('ui-draggable-disabled');
										$('#draggable8').parent('li').find('span').removeClass('on');
										$('#draggable8').parent('li').find('span').addClass('gary');
										$('#draggable8').draggable("disable");
				                    	html += '<div class="m_xline" id="city">'+
										'<span>城市</span>'+
										'<div class="right">'+
											'<input type="text" class="text" />'+
										'</div>'+
										'<em onclick="last_remove(\''+"city"+'\')">移除</em>'+
									   '</div>';
									}
							        if (id=="faxa") {
				                    	$('#draggable12').addClass('ui-draggable-disabled');
										$('#draggable12').parent('li').find('span').removeClass('on');
										$('#draggable12').parent('li').find('span').addClass('gary');
										$('#draggable12').draggable("disable");
				                    	html += '<div class="m_xline" id="fax">'+
				                    	 '<span>传真</span>'+
				                    	 '<div class="right">'+
				                    	 '<input type="text" class="text" />'+
				                    	 '</div>'+
				                    	 '<em onclick="last_remove(\''+"fax"+'\')">移除</em>'+
				                    	 '</div>';
				                    }
							        if (id=="taga") {
				                    	$('#draggable13').addClass('ui-draggable-disabled');
										$('#draggable13').parent('li').find('span').removeClass('on');
										$('#draggable13').parent('li').find('span').addClass('gary');
										$('#draggable13').draggable("disable");
				                    	html += '<div class="m_xline" id="tag">'+
										'<span>标签</span>'+
										'<div class="right">'+
											'<input type="text" class="text" />'+
										'</div>'+
										'<em onclick="last_remove(\''+"tag"+'\')">移除</em>'+
									    '</div>';
									}
							}
				 
				    }
				});
				

		        /* 自定义控件 */
		        
		        $('#fix_html>div>.datatime').each(function(m,data) {
		        	if (($(data).text())!=null&&($(data).text())!="") {
		        		dataid =$(data).text().trim();
		        	    
		        	    datatype = $("#TypeId"+dataid).text().trim();
		        		
		        		
		        		if (datatype=="数字") {
		        		    $('#name_数字').attr("value",dataid);
		        	        html +=	$('.m_xboxs,.always>.now>li>div>.m_xline>.right').find('div[id="数字"]').parents('.m_xline').parent('div').html();
		        		   
		        		}
		        		if (datatype=="单行文本") {
		        			 $('#name_单行文本').attr("value",dataid);
		        			html +=	$('.m_xboxs,.always>.now>li>div>.m_xline>.right').find('div[id="单行文本"]').parents('.m_xline').parent('div').html();
						}
		        		if (datatype=="多行文本") {
		        			 $('#name_多行文本').attr("value",dataid);
		        			html +=	$('.m_xboxs,.always>.now>li>div>.m_xline>.right').find('div[id="多行文本"]').parents('.m_xline').parent('div').html();
			        		
						}
		        		if (datatype=="日期") {
		        			 $('#name_日期').attr("value",dataid);
		        			html +=	$('.m_xboxs,.always>.now>li>div>.m_xline>.right').find('div[id="日期"]').parents('.m_xline').parent('div').html();
			        		
						}
		        		if (datatype=="评分") {
		        			 $('#name_评分').attr("value",dataid);
		        			html +=	$('.m_xboxs,.always>.now>li>div>.m_xline>.right').find('div[id="评分"]').parents('.m_xline').parent('div').html();
			        		
						}
		        		if (datatype=="单选") {
		        			var options = "";
		        			$(data).parents('.m_xline').find('.right').find('select').find('option').each(function(n,op){
		        				options+=$(op).text()+",";
			        		});
		        			options= options.substring(0,options.length-1);
		        			 $('#name_单选').attr("value",dataid);
		        			
		        			 $('#name_单选').parents('.right').find('textarea').text(options);
		        			
		        			html +=	$('.m_xboxs,.always>.now>li>div>.m_xline>.right').find('div[id="单选"]').parents('.m_xline').parent('div').html();
			        		
						}
		        		if (datatype=="下拉列表") {
		        			var options = "";
		        			$(data).parents('.m_xline').find('.right').find('select').find('option').each(function(n,op){
		        				options+=$(op).text()+",";
			        		});
		        			options= options.substring(0,options.length-1);
		        			 $('#name_下拉列表').attr("value",dataid);
		        			
		        			 $('#name_下拉列表').parents('.right').find('textarea').text(options);
		        			
		        			html +=	$('.m_xboxs,.always>.now>li>div>.m_xline>.right').find('div[id="下拉列表"]').parents('.m_xline').parent('div').html();
			        		
						}
		        		if (datatype=="多选") {
		        			
		        			var options = "";
		        			$(data).parents('.m_xline').find('.right').find('select').find('option').each(function(n,op){
		        				options+=$(op).text()+",";
			        		});
		        			options= options.substring(0,options.length-1);
		        			 $('#name_多选').attr("value",dataid);
		        			
		        			 $('#name_多选').parents('.right').find('textarea').text(options);
		        			 
		        			html +=	$('.m_xboxs,.always>.now>li>div>.m_xline>.right').find('div[id="多选"]').parents('.m_xline').parent('div').html();
			        		
						}
		        		if (datatype=="图片") {
		        			 $('#name_图片').attr("value",dataid);
		        			html +=	$('.m_xboxs,.always>.now>li>div>.m_xline>.right').find('div[id="图片"]').parents('.m_xline').parent('div').html();
			        		
						}
		        		if (datatype=="附件") {
		        			 $('#name_附件').attr("value",dataid);
		        			html +=	$('.m_xboxs,.always>.now>li>div>.m_xline>.right').find('div[id="附件"]').parents('.m_xline').parent('div').html();
			        		
						}
		        		if (datatype=="分割线") {
		        			html +=	$('.m_xboxs,.always>.now>li>div>.m_xline>.right').find('div[id="分割线"]').parents('.m_xline').parent('div').html();
			        		
						}
		        		
		        		
		        	}
		        });
		        
				
				
				
				 $('#droppable').html(html);
				
				
				$this.parents('.m_xconsum').removeClass('show');
				$('.m_xsubunit').addClass('show');
			
			
		});
		
		
	})
	
	
// 	$('#droppable').find('.m_xline').find('em').click(function() {
// 			$(this).parent().remove();
// 			var self = this;
// 			$('.only').each(function(index, item) {
// 				if($(item).find('.m_xline').attr('id') == $(self).parent().attr('id')) {
// 					$(item).siblings().removeClass('gary');
// 					$(item).siblings().addClass('on');
// 					$(item).draggable("enable");
// 				}
// 			})
// 		})
	function last_remove(val){
		
		if (val=="phone"||val=="email") {
			alert("默认必选项无法移除");
		} else {
		
		var val = "#"+val;
		$('#droppable').find(val).remove();
		//$(val).remove();
		
		//$('#draggable').addClass('ui-draggable-disabled');
		reflashstatus(val);
		}
	}
	
	function reflashstatus(val){
		if (val=="#name") {
			$('#draggable').parent('li').find('span').addClass('on');
			$('#draggable').parent('li').find('span').removeClass('gary');
			$('#draggable').draggable("enable");
		}
		if (val=="#phone") {
			$('#draggable3').parent('li').find('span').addClass('on');
			$('#draggable3').parent('li').find('span').removeClass('gary');
			$('#draggable3').draggable("enable");
		}
		if (val=="#email") {
			$('#draggable7').parent('li').find('span').addClass('on');
			$('#draggable7').parent('li').find('span').removeClass('gary');
			$('#draggable7').draggable("enable");
		}
		if (val=="#company") {
			$('#draggable10').parent('li').find('span').addClass('on');
			$('#draggable10').parent('li').find('span').removeClass('gary');
			$('#draggable10').draggable("enable");
		}
		if (val=="#job") {
			$('#draggable11').parent('li').find('span').addClass('on');
			$('#draggable11').parent('li').find('span').removeClass('gary');
			$('#draggable11').draggable("enable");
		}
		if (val=="#remark") {
			$('#draggable14').parent('li').find('span').addClass('on');
			$('#draggable14').parent('li').find('span').removeClass('gary');
			$('#draggable14').draggable("enable");
		}
		/*  */
		if (val=="#gender") {
			$('#draggable1').parent('li').find('span').addClass('on');
			$('#draggable1').parent('li').find('span').removeClass('gary');
			$('#draggable1').draggable("enable");
		}
		if (val=="#birthday") {
			$('#draggable2').parent('li').find('span').addClass('on');
			$('#draggable2').parent('li').find('span').removeClass('gary');
			$('#draggable2').draggable("enable");
		}
		if (val=="#weibo") {
			$('#draggable4').parent('li').find('span').addClass('on');
			$('#draggable4').parent('li').find('span').removeClass('gary');
			$('#draggable4').draggable("enable");
		}
		if (val=="#qq") {
			$('#draggable5').parent('li').find('span').addClass('on');
			$('#draggable5').parent('li').find('span').removeClass('gary');
			$('#draggable5').draggable("enable");
		}
		if (val=="#wechat") {
			$('#draggable6').parent('li').find('span').addClass('on');
			$('#draggable6').parent('li').find('span').removeClass('gary');
			$('#draggable6').draggable("enable");
		}
		if (val=="#address") {
			$('#draggable9').parent('li').find('span').addClass('on');
			$('#draggable9').parent('li').find('span').removeClass('gary');
			$('#draggable9').draggable("enable");
		}
		if (val=="#city") {
			$('#draggable8').parent('li').find('span').addClass('on');
			$('#draggable8').parent('li').find('span').removeClass('gary');
			$('#draggable8').draggable("enable");
		}
		
		if (val=="#fax") {
			$('#draggable12').parent('li').find('span').addClass('on');
			$('#draggable12').parent('li').find('span').removeClass('gary');
			$('#draggable12').draggable("enable");
		}
		if (val=="#tag") {
			$('#draggable13').parent('li').find('span').addClass('on');
			$('#draggable13').parent('li').find('span').removeClass('gary');
			$('#draggable13').draggable("enable");
		}
	}
	

/* *********************自定义控件-截止********************************** */
    var domainip ="http://scrm.cecook.cn"; 
    //var domainip ="http://localhost:8080"; 
	var startIndex = 1;// 起始页数
	var pageSize = 5;//每页行数
	$(function (){
		var id = $("#customerID").val();
		customerInfo(id);
		customerAction(id);
	});
	function customerInfo(id){
		$.post('<%=path%>/api/custome/getCustomerInfo', {
			'customerID': id,
			'startIndex':startIndex,
			'pageSize' : pageSize,
    	}, function(data) {
    		data = JSON.parse(data);
    		customerhtml(data);
    	});
	}
	function customerAction(id){
		$.post('<%=path%>/api/customer_action/getCustomerAction', {
			'id': id,
    	}, function(data) {
    		data = JSON.parse(data);
    		customerActionHtml(data);
    	});
	}
	function customerActionHtml(data){
		var html = '';
		if(data.actionList != 0){
			$.each( data.actionList,
					function(n, value){
				html += '<div class="m_xaction">';
				html += '<i></i>';
				html += '<b><img src="<%=path%>/bc/images/trio.png" /></b>';
				html += '<div class="time">';
				html += '<strong>';
				if(value.enjoyStatus == 1 && value.handleStatus == 1){
					html += '<img src="<%=path%>/bc/images/opt_1.png" />';
				}else if(value.enjoyStatus == 1 && value.handleStatus == 0){
					html += '<img src="<%=path%>/bc/images/opt_2.png" />';
				}else{
					html += '<img src="<%=path%>/bc/images/opt_3.png" />';
				}
				html += '</strong>';
				html += '<span>'+value.strTime+'</span>';
				html += '</div><div class="main">';
				html += '<div class="inward">';
				html += '<span class="first"><a href="javascript:;">'+value.content+'</a></span>';
				html += '<span>'+getName(value)+'</span>';
				html += '<span class="btns"><a href="javascript:;">'+(value.enjoyStatus == 0 ? "已参与" :"已参与")+'</a></span>';
				html += '<span class="btns"><a href="javascript:;">'+(value.handleStatus == 0 ? "未处理" : "已处理")+'</a></span>';
				html += '<span class="last">'+(value.source == null ? "未知" :getSourceTitle(value.source))+'</span>';
				html += '</div>';
				html += '</div></div>';
			});
			$(".m_xannals").append(html);
		}
	}
	
	function getName(data){
		var name="未知";

		if(data.type=="3"){
			if(StringEmpty(data.activityName)){
				name=data.activityName;
			}
		}else{
			if(StringEmpty(data.activityName)){
				name=data.activityName;
			}
		}
		return name;
	}
	
	
	function getSourceTitle(source){
		var title;
		switch (source) {
		case "1":
			title="微博";
			break;
		case "2":
			title="微信";
			break;
		case "3":
			title="QQ";
			break;
		case "4":
			title="活动";
		case "5":
			title="pc网页";
		case "6":
			title="短信";
			break;
		default:
			title="未知";
			break;
		}
		return title;
		
	}
	function customerhtml(value){
		var html = '<div class="m_xessent consu">';
		if(value == 0){
			html +='暂无数据</div>';
		}else{
		html += '<div class="basis">';
		html += '<div class="into">消费信息</div>';
		html += '<div class="strot">';
		html += '<p><span>累计消费: </span>'+ (value.countRanking.moneyTotal == null ? 0 : value.countRanking.moneyTotal) + '元</p>';
		html += '<p><span>频率/时间属性</span>' + (value.countRanking.totalConsumption == null ? 0 : value.countRanking.totalConsumption) + '次';
		html += '/' + (value.countRanking.totalDay == -1 ? "无消费记录" : value.countRanking.totalDay) + '天</p>';
		html += '<p class="one"><span>第一次消费</span>'
				+ (value.countRanking.first_write_off_time == null ? '暂无消费记录' : value.countRanking.first_write_off_time);
		html += '<em>' + (value.countRanking.first_consumption_amount == null ? "/0" : "/"
								+ value.countRanking.first_consumption_amount) + '</em></p>';
		html += '<p class="one"><span>最近消费</span>'
				+ (value.countRanking.lately_write_off_time == null ? '暂无消费记录' : value.countRanking.lately_write_off_time);
		html += '<em>'
				+ (value.countRanking.lately_consumption_amount == null ? "/0" : "/" + value.countRanking.lately_consumption_amount)
				+ '</em></p>';
		html += '</div>';
		html += '<div class="line"><span></span></div>';
		html += '<div class="abs s_abs">累计消费<em>'+(value.countRanking.moneyTotal == null ? 0 : value.countRanking.moneyTotal)+'</em>元';
		html += '<span>排名<em>'+(value.countRanking.moneyRanking)+'/'+(value.countRanking.customerCount)+'</em></span></div>';
		html += '<div class="line row"><span></span></div>';
		html += '<div class="abs">消费总数<em>'+value.countRanking.totalConsumption+'</em>次';
		html += '<span>排名<em>'+value.countRanking.countRanking+'/'+value.countRanking.customerCount+'</em></span></div>';
		html += ' </div></div>';
		html += '<div class="m_xessent">';
		html += '<div class="side">';
		html += '<i><img src="'+((value.bcCustomer.avatar == null || value.bcCustomer.avatar == undefined || value.bcCustomer.avatar == "") ? "<%=path%>/images/000head_pic.png" : value.bcCustomer.avatar)+'" /></i>';
		html += '<a href="javascript:;" class="exch" >交流</a>';
		html += '<p>客户所有人:<span>公用</span></p>';
		html += '<a href="javascript:;" class="delect" onclick="deleteCustomer()">删除此客户</a>';
		html += '</div>';
		html += '<div class="basis">';
		html += '<div class="into">';
		html += '<a href="javascript:;" class="edit" id="editCustomer" onclick="findByCustomerId()"></a>';
		html += '<div class="tans">';
		if (value.newOrOldCustomer == 2) {
			html += '<i style="margin-top: 12px;"><img src="<%=path%>/bc/images/host_6.png" /></i>';
		} else if (value.newOrOldCustomer == 3) {
			html += '<i style="margin-top: 12px;"><img src="<%=path%>/bc/images/host_3.png" /></i>';
		}
		if (value.transactionFrequency == 2) {
			html += '<i class="host" style="margin-top: 12px;"><img src="<%=path%>/bc/images/host_2.png" /></i>';
		} else if (value.transactionFrequency == 3) {
			html += '<i class="host" style="margin-top: 12px;"><img src="<%=path%>/bc/images/host_7.png" /></i>';
		} else if (value.transactionFrequency == 4) {
			html += '<i class="host" style="margin-top: 12px;"><img src="<%=path%>/bc/images/host_5.png" /></i>';
		}
		if (value.transactionLimit == 2) {
			html += '<i class="abst" style="margin-top: 12px;"><img src="<%=path%>/bc/images/host_1.png" /></i>';
		} else if (value.transactionLimit == 3) {
			html += '<i class="abst" style="margin-top: 12px;"><img src="<%=path%>/bc/images/host_8.png" /></i>';
		} else if (value.transactionLimit == 4) {
			html += '<i class="abst" style="margin-top: 12px;"><img src="<%=path%>/bc/images/host_9.png" /></i>';
		}
		
		var sex = "无";
		console.log("性别测试…………………………………………"+(value.bcCustomer.gender));
		if(value.bcCustomer.gender =="男"){
			sex="男";
		}
		if(value.bcCustomer.gender =="女"){
			sex="女";
		}
		console.log("value.countRanking.customer_source--->"+value.countRanking.customer_source);
		html += '</div>';
		html += ' 基本信息</div><div class="strot">';
		html += '<p><span>姓名：</span>'+value.bcCustomer.name+'</p>';
		html += '<p><span>性别：</span>'+sex+'</p>';
		html += '<p><span>电话：</span>'+(value.bcCustomer.phone == null ? '' : value.bcCustomer.phone)+'</p>';
		html += '<p><span>生日：</span>'+(value.bcCustomer.birthday == null ? '' :value.bcCustomer.birthday)+'</p>';
		html += '<p><span>邮箱：</span><a href="javascript:;" class="blue">'+(value.bcCustomer.email == null ? '' : value.bcCustomer.email)+'</a></p>';
		html += '<p><span>来源：</span>'+(value.bcCustomer.customer_source == null ? "未知" : value.bcCustomer.customer_source) +'</p>';
		html += '<p><span>微信号：</span>'+(value.bcCustomer.wechat == null ? '' :value.bcCustomer.wechat)+'</p>';
		html += '<p><span>微博：</span>'+(value.bcCustomer.weibo == null ? '' : value.bcCustomer.weibo)+'</p>';
		html += '</div>';
		html += '</div>';
		html += '</div>';
		html += '</div>';
		html += '</div>';
		}
		$(".m_xinforma").html(html);
	}
	var id = $("#customerID").val();
	function deleteCustomer(){
		if(confirm('确定要删除此客户吗?')) { 
		$.post('<%=path%>/api/custome/delCustomer', {
			'id': id,
    	}, function(data) {
    		data = JSON.parse(data);
    		if(data.status == 200){
    			customerInfo(id);
    		}else{
	    		alert("删除失败！");
    		}
    	});
		}
		return false; 
	}
	
	$(function(){
		/*聊天点击开始*/
		$(document).on("click",".exch",function(){
			console.log("customer_id------->"+$("#customerID").val());
			//初始化数据，全部设置0
			top.customerId = 0;
			top.actionId = 0;
			top.clueWeiboId = 0;
			top.writeOffId = 0;
			top.customerId = $("#customerID").val();
<%-- 			$.post("<%=path%>/api/customer_action/customerChatView",function(data){ --%>
				var d = top.dialog({
					fixed: true,
					zIndex: 10000,
					padding:0,
					width:1172,
					height:568,
					title:'沟通记录',
// 					content:data,
					url:"<%=path%>/api/customer_action/customerChatView",
					cancelDisplay: false,
					cancel: function () {
						if(top.customerChatChange == 1){
							top.customerChatChange = 0;
						}
						top.customerId = 0;
						return true;
					}
				});
				d.showModal();
// 			})
		});
	});
	$(function() {
		$("#genderadd").hide();
		$("#birthdayadd").hide();
		$("#weiboadd").hide();
		$("#qqadd").hide();
		$("#wechatadd").hide();
		$("#addressadd").hide();
		$("#cityadd").hide();
		$("#faxadd").hide();
		$("#tagadd").hide();
	})
	function add() {
		//构建控件结构字符串
		var controlhierarchystrings = "";//分割结构 {type:"",name:"" ,vals = "val&val"},
		
		var id = '';
		if ($('#droppable > div').size() == 0) {
			
		} else {
			
			$("#nameadd").hide();
			$("#phoneadd").hide();
			$("#emailadd").hide();
			$("#companyadd").hide();
			$("#jobadd").hide();
			$("#remarksadd").hide();
			$("#genderadd").hide();
			$("#birthdayadd").hide();
			$("#weiboadd").hide();
			$("#qqadd").hide();
			$("#wechatadd").hide();
			$("#addressadd").hide();
			$("#cityadd").hide();
			$("#faxadd").hide();
			$("#tagadd").hide();
			$('#droppable > div').each(function(i, data) {
				id = $(data).attr('id');
				$('#' + id + 'add').show();
				if (id!=null) {
					//记录结构
					controlhierarchystrings +=	"{type :"+"\""+"FristType"+"\""+","+"key :"+"\""+id+"\""+","+"value :"+"\""+""+"\""+"}"+","; 
					
				}
				
			});
		}
		/* zhiwen  */
		var cookie_string ="";
		var plusstring_value = "";
		   $('#droppable > .m_xline').each(function(i, data) {
			   
				if (($(data).find('.right').find('div').attr('id'))!=null&&$(data).find('.right').find('div').attr('id')!="") {
				var	type_id = $(data).find('.right').find('div').attr('id');
				cookie_string += type_id +":";
				    console.log(type_id);
				    
				    if (($(data).find('.right').find('input').val())!=null&&($(data).find('.right').find('input').val())!="") {
						var plus_name=$(data).find('.right').find('input').val();
						cookie_string += plus_name +"&";
						console.log(plus_name);
						
						if (($(data).find('.right').find('textarea').val())!=null&&($(data).find('.right').find('textarea').val())!="") {
							var plus_val=$(data).find('.right').find('textarea').val().trim();
							plusstring_value+=plus_name+":"+plus_val+"&";
							console.log("键值对为："+plusstring_value);
						} 
						
					}else {
						cookie_string +=  "&";
						alert(type_id +"不能为空,否者无法为您生成控件");
					}
				}
				
				if (($(data).find('div').attr('id'))!=null&&($(data).find('div').attr('id'))!="") {
					var only_name = $(data).find('div').attr('id');
					 cookie_string += only_name + ":"+only_name + "&";
					 console.log(only_name);
				}
				
			});
		 console.log(cookie_string);
		 //document.cookie="path=/bc;plus_data="+escape(cookie_string);//存入cookie并设置访问域
		if (cookie_string!=null&&cookie_string!="") {
			var array = new Array();//第一次分割
			var arrayob = new Array();//第二次分割
			array = cookie_string.split("&");
			console.log("循环数"+array);
			var html="";//创建html对象
			for (var i = 0; i < array.length; i++) {
				console.log("循环次数"+array[i]);
				if (array[i]!=null&&array[i]!="") {
					arrayob = array[i].split(":");
					if (arrayob[0]!=null&&arrayob[1]!=null&&arrayob[0]!=""&&arrayob[1]!=null){
						console.log("打印："+arrayob[0]);
						console.log("打印："+arrayob[1]);
						
					
						if ("数字"==arrayob[0].trim()) {
							
							console.log("空测试："+arrayob[1]);
							if ((arrayob[1].trim())!=null&&(arrayob[1].trim())!="") {
								//存入数字结构
								controlhierarchystrings +=	"{type :"+"\""+"数字"+"\""+","+"key :"+"\""+arrayob[1].trim()+"\""+","+"value :"+"\""+""+"\""+"}"+","; 
								//拼装显示控件
								html +='<div class="m_xline">'+
								'<span class="datatime">'+arrayob[1].trim()+'</span>'+
								'<div class="right">'+
								'<div id="TypeId'+arrayob[1].trim()+'" style="display:none">数字</div>'+
								'<div id="'+arrayob[1].trim()+'" style="display:none">'+arrayob[1].trim()+'</div>'+
								'<input type="number" class="text"  id = "fix_'+arrayob[1].trim()+'" name="fix_'+arrayob[1].trim()+'" />'+
								'</div>'+
								'</div>';
							}
							
						}
						 if ("单行文本"==arrayob[0].trim()) {
							 console.log("空测试："+arrayob[1]);
							 if ((arrayob[1].trim())!=null&&(arrayob[1].trim())!="") {
								 
								//存入单行文本结构
								controlhierarchystrings +=	"{type :"+"\""+"单行文本"+"\""+","+"key :"+"\""+arrayob[1].trim()+"\""+","+"value :"+"\""+""+"\""+"}"+","; 
								 
								 html +='<div class="m_xline">'+
									'<span class="datatime">'+arrayob[1].trim()+'</span>'+
									'<div class="right">'+
									'<div id="TypeId'+arrayob[1].trim()+'" style="display:none">单行文本</div>'+
									'<div id="'+arrayob[1].trim()+'" style="display:none">'+arrayob[1].trim()+'</div>'+
									'<input type="text" class="text" placeholder="请输入'+arrayob[1].trim()+'" id = "fix_'+arrayob[1].trim()+'" name="fix_'+arrayob[1].trim()+'" />'+
									'</div>'+
									'</div>';
								}
							
						}
						
						 if ("多行文本"==arrayob[0].trim()) {
							 if ((arrayob[1].trim())!=null&&(arrayob[1].trim())!="") {
								 
								//存入多行文本结构
									controlhierarchystrings +=	"{type :"+"\""+"多行文本"+"\""+","+"key :"+"\""+arrayob[1].trim()+"\""+","+"value :"+"\""+""+"\""+"}"+","; 
								 
								 html +='<div class="m_xline">'+
									'<span class="datatime">'+arrayob[1].trim()+'</span>'+
									'<div class="right">'+
									'<div id="TypeId'+arrayob[1].trim()+'" style="display:none">多行文本</div>'+
									'<div id="'+arrayob[1].trim()+'" style="display:none">'+arrayob[1].trim()+'</div>'+
									'<textarea type="text" class="text" placeholder="请输入'+arrayob[1].trim()+'" id = "fix_'+arrayob[1].trim()+'" name="fix_'+arrayob[1].trim()+'" ></textarea>'+
									'</div>'+
									'</div>';
								}
							
						}
						
						 if ("单选"==arrayob[0].trim()) {
							 if ((arrayob[1].trim())!=null&&(arrayob[1].trim())!="") {
									var fix_value=new Array();
									fix_value =plusstring_value.split("&");//分割键值对
									var select1val ="";//下拉框值html
									for (var m= 0; m < fix_value.length; m++) {
										if ((fix_value[m])!=null&&(fix_value[m])!="") {
											var key_value=  new Array();
											key_value=	fix_value[m].split(":");
											if ((key_value[0])!=null&&(key_value[0])!=""&&(key_value[1])!=null&&(key_value[1])!="") {
												if ((arrayob[1].trim())==(key_value[0].trim())) { //两个array键相等
													var final_val= new Array();
												    var seoption=key_value[1];
												    seoption= seoption.replace(eval("/"+"，"+"/g"),",");
												    
												   //存入单选结构
													controlhierarchystrings +=	"{type :"+"\""+"单选"+"\""+","+"key :"+"\""+arrayob[1].trim()+"\""+","+"value :"+"\""+seoption+"\""+"}"+","; 
												    
													final_val =seoption.split(",");
													if (final_val.length>0) {
														for (var n = 0; n < final_val.length; n++) {
															select1val+='<option value="'+final_val[n].trim()+'">'+final_val[n].trim()+'</option>';
														}
													}
												}
											}
										}
									}
									 console.log(select1val);
									 
									 html +='<div class="m_xline">'+
										'<span class="datatime">'+arrayob[1].trim()+'</span>'+
										'<div class="right">'+
										'<div id="TypeId'+arrayob[1].trim()+'" style="display:none">单选</div>'+
										'<div id="'+arrayob[1].trim()+'" style="display:none">'+arrayob[1].trim()+'</div>'+
										'<select style="height:48px;width:330px;font-size:14px;" id = "fix_'+arrayob[1].trim()+'" name="fix_'+arrayob[1].trim()+'" class="m_xselect " > '+select1val+'</select>'+
										'</div>'+
										'</div>';
									 console.log("跳出单选");	
								}
						
						}
						
						 if ("多选"==arrayob[0].trim()) {
							 if ((arrayob[1].trim())!=null&&(arrayob[1].trim())!="") {
								 console.log("进入多选");
								 var fix_value1=new Array();
									fix_value1 =plusstring_value.split("&");//分割键值对
									var select1val1 ="";//下拉框值html
									for (var m = 0; m < fix_value1.length; m++) {
										if ((fix_value1[m])!=null&&(fix_value1[m])!="") {
											var key_value1=  new Array();
											key_value1=	fix_value1[m].split(":");
											 console.log(key_value1[0].trim()+key_value1[1].trim());
											if ((key_value1[0])!=null&&(key_value1[0])!=""&&(key_value1[1])!=null&&(key_value1[1])!="") {
												if ((arrayob[1].trim())==(key_value1[0].trim())) { //两个array键相等
													var final_val1= new Array();
													 var seoption=key_value1[1];
													 seoption= seoption.replace(eval("/"+"，"+"/g"),",");
													 
													//存入多选结构
													controlhierarchystrings +=	"{type :"+"\""+"多选"+"\""+","+"key :"+"\""+arrayob[1].trim()+"\""+","+"value :"+"\""+seoption+"\""+"}"+","; 
													    
													 
													    final_val1 =seoption.split(",");
													if (final_val1.length>0) {
														for (var n = 0; n < final_val1.length; n++) {
															select1val1+='<option value="'+final_val1[n].trim()+'">'+final_val1[n].trim()+'</option>';
														}
													}
												}
											}
										}
									}
									 console.log(select1val1);
								 
								 html +='<div class="m_xline">'+
									'<span class="datatime">'+arrayob[1].trim()+'</span>'+
									'<div class="right">'+
									'<div id="TypeId'+arrayob[1].trim()+'" style="display:none">多选</div>'+
									'<div id="'+arrayob[1].trim()+'" style="display:none">'+arrayob[1].trim()+'</div>'+
									'<select style="height:48px;width:330px;font-size:14px;"  multiple="multiple"  id = "fix_'+arrayob[1].trim()+'" name="fix_'+arrayob[1].trim()+'" class="m_xselect" >'+
									select1val1+
									'</select>'+
									'</div>'+
									'</div>';
								 console.log("跳出多选");
								}
							 
							
						}
						
						 if ("下拉列表"==arrayob[0].trim()) {
							 if ((arrayob[1].trim())!=null&&(arrayob[1].trim())!="") {
								 var fix_value1=new Array();
									fix_value1 =plusstring_value.split("&");//分割键值对
									var select1val1 ="";//下拉框值html
									for (var m = 0; m < fix_value1.length; m++) {
										if ((fix_value1[m])!=null&&(fix_value1[m])!="") {
											var key_value1=  new Array();
											key_value1=	fix_value1[m].split(":");
											 console.log(key_value1[0].trim()+key_value1[1].trim());
											if ((key_value1[0])!=null&&(key_value1[0])!=""&&(key_value1[1])!=null&&(key_value1[1])!="") {
												if ((arrayob[1].trim())==(key_value1[0].trim())) { //两个array键相等
													var final_val1= new Array();
													 var seoption=key_value1[1];
													 seoption= seoption.replace(eval("/"+"，"+"/g"),",");
													 
													//存入下拉列表结构
													controlhierarchystrings +=	"{type :"+"\""+"下拉列表"+"\""+","+"key :"+"\""+arrayob[1].trim()+"\""+","+"value :"+"\""+seoption+"\""+"}"+","; 
													    
													 
													    final_val1 =seoption.split(",");
													if (final_val1.length>0) {
														for (var n = 0; n < final_val1.length; n++) {
															select1val1+='<option value="'+final_val1[n].trim()+'">'+final_val1[n].trim()+'</option>';
														}
													}
												}
											}
										}
									}
									 console.log(select1val1);
									 html +='<div class="m_xline">'+
									'<span class="datatime">'+arrayob[1].trim()+'</span>'+
									'<div class="right">'+
									'<div id="TypeId'+arrayob[1].trim()+'" style="display:none">下拉列表</div>'+
									'<div id="'+arrayob[1].trim()+'" style="display:none">'+arrayob[1].trim()+'</div>'+
									'<select style="height:48px;width:330px;font-size:14px;"  id = "fix_'+arrayob[1].trim()+'" name="fix_'+arrayob[1].trim()+'" class="m_xselect" >'+
									select1val1+
									'</select>'+
									'</div>'+
									'</div>';
								}
							
						}
						 
						
						 if ("日期"==arrayob[0].trim()) {
							 if ((arrayob[1].trim())!=null&&(arrayob[1].trim())!="") {
								 
								//存入单行文本结构
								controlhierarchystrings +=	"{type :"+"\""+"日期"+"\""+","+"key :"+"\""+arrayob[1].trim()+"\""+","+"value :"+"\""+""+"\""+"}"+","; 
									 
								 
								 html +='<div >'+
									'<span class="datatime" style="width: 20%;margin-top: 8px;float: left;text-align: right;margin-left: -19px;font-size:14px;">'+arrayob[1].trim()+'</span>'+
									'<div class="right">'+
									'<div id="TypeId'+arrayob[1].trim()+'" style="display:none">日期</div>'+
									'<div id="'+arrayob[1].trim()+'" style="display:none">'+arrayob[1].trim()+'</div>'+
									    '<div style="width: 330px;heigth:48px;margin-left:90px;">'+
									         '<div class="form-group"> '+
									               '<div class="input-group date" id="Time_'+arrayob[1].trim()+'">'+
	                                                   '<input  id = "fix_'+arrayob[1].trim()+'" name="fix_'+arrayob[1].trim()+'" type="text" class="form-control" /> '+
	                                                   '<span class="input-group-addon">'+
	                                                          '<span class="glyphicon glyphicon-calendar">'+
	                                                          '</span>'+
	                                                   '</span></div></div></div> '+
	                                '</div>'+
									'</div>';
							}
							 datadpid +="#Time_"+arrayob[1].trim()+",";
						}
						 
						
						 if ("评分"==arrayob[0].trim()) {
							 if ((arrayob[1].trim())!=null&&(arrayob[1].trim())!="") {
								 
								//存入单行文本结构
							    controlhierarchystrings +=	"{type :"+"\""+"评分"+"\""+","+"key :"+"\""+arrayob[1].trim()+"\""+","+"value :"+"\""+""+"\""+"}"+","; 
									 
								 
								 html +='<div class="m_xline">'+
									'<span class="datatime">'+arrayob[1].trim()+'</span>'+
									'<div class="right">'+
									'<div id="TypeId'+arrayob[1].trim()+'" style="display:none">评分</div>'+
									'<div id="'+arrayob[1].trim()+'" style="display:none">'+arrayob[1].trim()+'</div>'+
// 									
									'<div class="m_xstra lsg" style="width: 150px;">'+
									'<img src="<%=path%>/images/star_2.png" '+
										'onclick="pfClick(this)" style="width: 13px;" '+
										'class="unSelect"> <img '+
										'src="<%=path%>/images/star_2.png" onclick="pfClick(this)" '+
										'style="width: 13px;" class="unSelect"> <img  '+
										'src="<%=path%>/images/star_2.png" onclick="pfClick(this)" '+
										'style="width: 13px;" class="unSelect"> <img '+
										'src="<%=path%>/images/star_2.png" onclick="pfClick(this)"  '+
										'style="width: 13px;" class="unSelect"> <img '+
										'src="<%=path%>/images/star_2.png" onclick="pfClick(this)"  '+
										'style="width: 13px;" class="unSelect">  '+
									'<dfn class="pfText">0.0分</dfn>  '+
									'<input type="text" id = "fix_'+arrayob[1].trim()+'" name="fix_'+arrayob[1].trim()+'" style="display: none;" class="pf" /> '+
							     	'</div>  '+
									
									'</div>'+
									'</div>';
								}
							 
							
						}
						 
						 if ("图片"==arrayob[0].trim()) {
							 if ((arrayob[1].trim())!=null&&(arrayob[1].trim())!="") {
								 
								//存入单行文本结构
								controlhierarchystrings +=	"{type :"+"\""+"图片"+"\""+","+"key :"+"\""+arrayob[1].trim()+"\""+","+"value :"+"\""+""+"\""+"}"+","; 
									 
								 
								 html +='<div class="m_xline">'+
									'<span class="datatime">'+arrayob[1].trim()+'</span>'+
									'<div class="right">'+
									'<div id="TypeId'+arrayob[1].trim()+'" style="display:none">图片</div>'+
									'<div id="'+arrayob[1].trim()+'" style="display:none">'+arrayob[1].trim()+'</div>'+
									'<form id="file_'+arrayob[1].trim()+'" enctype="multipart/form-data" >'+
									
									'<div style="height: 100px;width: 100px;">'+
									'<div style="width:100px;height:100px; position:relative;float:left;margin-left:4px;">'+
									'<img id="img4'+arrayob[1].trim()+'" src="<%=path%>/bm/images/img_p.png" style="width:100px;height:100px;" >'+
									'</div>'+
									'<input type="file" accept="image/gif,image/jpeg,image/x-png" id = "fix_'+arrayob[1].trim()+'" name="fix_'+arrayob[1].trim()+'" onchange="showphoto(\''+arrayob[1].trim()+'\')" '+
									' style="cursor:pointer;height:100px;width: 100px;filter: alpha(opacity = 50); -moz-opacity: 0.5; -khtml-opacity: 0.5; opacity: 0.0;'+
									 'position: absolute; z-index: 99;">'+
									'</div>'+
									
									'</form>'+
									'</div>'+
									'</div>';
								}
							 
							
						}
						 
						 if ("分割线"==arrayob[0].trim()) {
							 if ((arrayob[1].trim())!=null&&(arrayob[1].trim())!="") {
								 
								//存入单行文本结构
								controlhierarchystrings +=	"{type :"+"\""+"分割线"+"\""+","+"key :"+"\""+arrayob[1].trim()+"\""+","+"value :"+"\""+""+"\""+"}"+","; 
									 
								 
								 html +='<div class="m_xline">'+
									'<span class="datatime">'+arrayob[1].trim()+'</span>'+
									'<div class="right">'+
									'<div id="TypeId'+arrayob[1].trim()+'" style="display:none">分割线</div>'+
									'<div id="'+arrayob[1].trim()+'" style="display:none">'+arrayob[1].trim()+'</div>'+
									'<span style="display: inline-block;width: 342px;height: 20px;border-bottom: 1px dashed #ddd;margin-left: 18px;"></span>'+
									'</div>'+
									'</div>';
								}
							 
							
						}
						 
						 if ("附件"==arrayob[0].trim()) {
							 if ((arrayob[1].trim())!=null&&(arrayob[1].trim())!="") {
								 
								//存入单行文本结构
							    controlhierarchystrings +=	"{type :"+"\""+"附件"+"\""+","+"key :"+"\""+arrayob[1].trim()+"\""+","+"value :"+"\""+""+"\""+"}"+","; 
									 
								 
								 html +='<div class="m_xline">'+
									'<span class="datatime">'+arrayob[1].trim()+'</span>'+
									'<div class="right">'+
									'<div id="TypeId'+arrayob[1].trim()+'" style="display:none">附件</div>'+
									'<div id="'+arrayob[1].trim()+'" style="display:none">'+arrayob[1].trim()+'</div>'+
									'<form id="realfile_'+arrayob[1].trim()+'" enctype="multipart/form-data" >'+
									
//										'<input type="file" id = "fix_'+arrayob[1].trim()+'" name="fix_'+arrayob[1].trim()+'" />'+
									'<div id="fileremove'+arrayob[1].trim()+'" name="have">'+
									'<input type="file" name="fix_'+arrayob[1].trim()+'" id = "fix_'+arrayob[1].trim()+'" >'+
									'</div>'+
									'</form>'+
									'</div>'+
									'</div>';
								}
							 
							 uploadpid +="#fix_"+arrayob[1].trim()+",";
						}
						 
						 
					}
				}
				
			}
			//拼接所有文本
			 $('.m_xpopups>.m_xconsum>#fix_html').html(html);
		}
	
		 //持久化控件结构   controlhierarchystrings
		  $.ajax({
   		  url: "<%=path%>/api/ComponentStructure/insert_ComponentStructure",

   		  type: "post",
   		  
   		  async: false,

   		  data:{"controlhierarchystrings":controlhierarchystrings},

   		  dataType: "json",

   		  timeout: 1000,

   		  error: function(){},

   		  success: function(data){
   			
            if (data.status=="0") {
            	console.log("持久化控件结构成功");
			}
   		  }
   		  
   		  }); 
		 
		 
		/*  */
		$('.m_xpopups , .m_xconsum').addClass('show');
		$('.m_xsubunit').removeClass('show');
	}
	    /* 定时器时间控件初始化 */
	    setInterval( function datetime() {
	    	//时间控件初始化
	    	if (datadpid!=null&&datadpid!="") {
	    		var array = new Array();
	    		array =datadpid.split(",");
	    		for (var i = 0; i < array.length; i++) {
	    			if ((array[i])!=null&&(array[i])!="") {
	    				console.log("定时器"+array[i].trim());
	    				$(array[i].trim()).datetimepicker({
	    					   minView:2,
					           daysOfWeekDisabled: [0,6]
					        });
					} else {
                         
					}
				}
	    		
	    		 
			}
	    	
	    	//上传控件初始化
	    	if (uploadpid!=null&&uploadpid!="") {
	    		var array2 = new Array();
	    		array2 =uploadpid.split(",");
	    		for (var i = 0; i < array2.length; i++) {
	    			if ((array2[i])!=null&&(array2[i])!="") {
	    				console.log("双上传定时器"+array2[i].trim());
	    				var arrays = new Array();
	    				arrays =array2[i].split("#fix_");
	    				var spid = "#fileremove"+arrays[1];
	    				console.log("拼接移除项" +spid);
	    				if (($(spid).attr("name"))!="") {
	    					$(array2[i].trim()).filer({
							    limit: 1,
							    maxSize: 3,
							   
							    changeInput: true,
							    showThumbs: true
							});
	    				 $(".jFiler-input-caption>span").css("width","200px");
	    				 $(".jFiler-input-caption>span").css("margin-top","-16px");
	    				 
	    				 $(".jFiler-input").css("width","330px");
	    					$(spid).attr("name","");
						}
	    				
	    			
	    			} else {
                         
					}
				}
	    		
	    		 
			}
				
			
			
		       
		       
		    },4000);
	
	    
	    
	  
		  function showphoto(m){
			  var idp = "#img4"+m;
			  $(idp).attr("src","<%=path%>/bm/images/img_cp.png");
		  }
		  
		  
		  /*  zhiwen */
		  function pfClick(dom) {

		  	if($(dom).attr('class') == 'unSelect') {
		  		$(dom).removeClass('unSelect').addClass('select')
		  		$(dom).attr('src', '<%=path%>/images/star_1.png');
		  	} else {
		  		$(dom).removeClass('select').addClass('unSelect')
		  		$(dom).attr('src', '<%=path%>/images/star_2.png');
		  	}
		  	$('.pfText').text($('.select').length + '.0分');
		  	$('.pf').attr('value', $('.select').length);

		  }

		  /*  */
		  	 
// 		  	   $(function () {
// 		  	       $('#datetimepicker11').datetimepicker({
// 		  	           daysOfWeekDisabled: [0,6]
// 		  	        });
// 		  	    });
		  	    
		  	 
		  
		  
		  /********************************************/
		
	function findByCustomerId(){
			  
		//显示结构
		ShowArchitecture();	  
			  
			  
		$.post('<%=path%>/api/custome/findByCustomerId', {
			"customerID" : id,
		}, function(data) {
			data = JSON.parse(data);
			if(data.bcCustomer != 0){
				resetCustomer();
				$("#namea").val(isnull(data.bcCustomer.name));
				$("#phonea").val(isnull(data.bcCustomer.phone));
				$("#emaila").val(isnull(data.bcCustomer.email));
				$("#companya").val(isnull(data.bcCustomer.company));
				$("#joba").val(isnull(data.bcCustomer.job));
				$("#remarksa").val(isnull(data.bcCustomer.remarks));
				$("#gendera").val(isnull(data.bcCustomer.gender));
				$("#birthdaya").val(isnull(data.bcCustomer.birthday));
				$("#weiboa").val(isnull(data.bcCustomer.weibo));
				$("#qqa").val(isnull(data.bcCustomer.qq));
				$("#wechata").val(isnull(data.bcCustomer.wechat));
				$("#addressa").val(isnull(data.bcCustomer.address));
				$("#citya").val(isnull(data.bcCustomer.city));
				$("#faxa").val(isnull(data.bcCustomer.fax));
				$("#taga").val(isnull(data.bcCustomer.tag));
				$("#customerID").val(id);
			}else{
				alert("编辑查询失败,未获取客户标识！")
			}
		});
		$('.m_xpopups , .m_xconsum').addClass('show');
		$('.m_xsubunit').removeClass('show');
	}
	//修改客户资料
	function updateCustomer(){
		
		//调用扩展方法
		saveCustomerExtend();
		console.log("集合串:"+finaldata);
		if (extendstatus==1) {//判断扩展信息是否正确传递过来
			extendstatus = 0;
		
		$.post('<%=path%>/api/custome/editCustomer', {
			"customerID" : id,
			"name" : $("#namea").val(),
			"phone" : $("#phonea").val(),
			"email" : $("#emaila").val(),
			"company" : $("#companya").val(),
			"job" : $("#joba").val(),
			"remarks" : $("#remarksa").val(),
			"gender" : $("#gendera").val(),
			"birthday" : $("#birthdaya").val(),
			"weibo" : $("#weiboa").val(),
			"qq" : $("#qqa").val(),
			"wechat" : $("#wechata").val(),
			"city" : $("#citya").val(),
			"fax" : $("#faxa").val(),
			"tag" : $("#taga").val(),
			"address" : $("#addressa").val(),
			"extenddata":finaldata,
		}, function(data) {
			$('.m_xpopups').removeClass('show');
			alert(data.message);
		});
		
		
	 } else {
	       alert("您的自定义内容存在错误,数据存在空值或者存在重名自定义控件,请重新自定义");
	 }
		
	}
	
	//显示客户扩展信息
	function showinfoextend(){
		if (($("#customerID").val())!=null&&($("#customerID").val())!="") {
			var cuex_id = $("#customerID").val();
			var html ="";
			   //提交到controller
	      	 $.ajax({
	        		  url:"<%=path%>/api/custome/showCustomerectend",
	       
	        		  type: "post",
	        		  
	        		  async: true,
	       
	        		  data:{id:cuex_id},
	       
	        		  dataType: "json",
	       
	        		  timeout: 1000,
	       
	        		  error: function(){},
	       
	        		  success: function(data){
			        		var returndata = eval(data);
			                if (returndata!=null) {
			                 	if (returndata.length>0) {
			                 		console.log("fan"+returndata.length);
			                 		var array = new Array();//多选组数
									for (var i = 0; i < returndata.length; i++) {
										if ((returndata[i].textNameType)!=""&&(returndata[i].textNameKey)!=""&&(returndata[i].textValue)!=""&&
									(returndata[i].textNameType)!=null&&(returndata[i].textNameKey)!=null&&(returndata[i].textValue)!=null) {
											   if ((returndata[i].textNameType)=="数字"||(returndata[i].textNameType)=="单行文本"||
													   (returndata[i].textNameType)=="多行文本"||(returndata[i].textNameType)=="日期"
														   ||(returndata[i].textNameType)=="单选"||(returndata[i].textNameType)=="下拉列表"
															   ) {
												     
												   var typeandkey=returndata[i].textNameType +"S"+returndata[i].textNameKey+"S"+cuex_id;
                                                     html +=
                                                   '<div class="m_xcaption" style="line-height:30px;height: auto;margin:0px 0px 0px;">'+
                                                   '<div id="'+returndata[i].textNameType+'" style="display:none"><div id="'+returndata[i].textNameKey+'" style="display:none"></div></div>'+
                                  				   '<span style="color:#999999;width: 100px;margin-left: 20px;">'+returndata[i].textNameKey+':'+'</span>'+
                                  				   '<span style="width: 100px;margin-left: 20px;">'+returndata[i].textValue+'</span>'+
                                  				   '<a href="javascript:;" style="color:#03A9F5;margin-left:30px;" '+
                                  				   'onclick="ex_remove(\''+typeandkey+'\')">移除</a>'+
                                  			       '</div>';
											   }
											   
											   if ((returndata[i].textNameType)=="图片" ) {
												     
												   var typeandkey=returndata[i].textNameType +"S"+returndata[i].textNameKey+"S"+cuex_id;
												   var url = domainip+returndata[i].textValue;
												   
                                                     html +=
                                                   '<div class="m_xcaption" style="line-height:30px;height: auto;margin:0px 0px 0px;">'+
                                                   '<div id="'+returndata[i].textNameType+'" style="display:none"><div id="'+returndata[i].textNameKey+'" style="display:none"></div></div>'+
                                  				   '<span style="color:#999999;width: 100px;margin-left: 20px;">'+returndata[i].textNameKey+':'+'</span>'+
//                                   				   '<span style="width: 100px;margin-left: 20px;">'+returndata[i].textValue+'</span>'+
                                                   '<img alt="正在加载图片,请稍后" style="width: 100px;height:100px;margin-left: 20px;" src="'+url+'">'+
                                  				   '<a href="javascript:;" style="color:#03A9F5;margin-left:30px;" '+
                                  				   'onclick="ex_remove(\''+typeandkey+'\')">移除</a>'+
                                  			       '</div>';
											   }
											   
											   if ((returndata[i].textNameType)=="附件" ) {
												     
												   var typeandkey=returndata[i].textNameType +"S"+returndata[i].textNameKey+"S"+cuex_id;
												 
												   console.log(returndata[i].textValue);
												   //returndata[i].textValue= escape(returndata[i].textValue);
												   console.log(returndata[i].textValue);
												   var url = domainip+returndata[i].textValue;
                                                     html +=
                                                    	 
                                                   '<div class="m_xcaption" style="line-height:30px;height: auto;margin:0px 0px 0px;">'+
                                                   '<div id="'+returndata[i].textNameType+'" style="display:none"><div id="'+returndata[i].textNameKey+'" style="display:none"></div></div>'+
                                  				   '<span style="color:#999999;width: 100px;margin-left: 20px;">'+returndata[i].textNameKey+':'+'</span>'+
                                  				   '<a style="text-decoration:none;cursor:pointer;color:#03A9F5;margin-left:30px;" href="'+url+'" download >下载</a>'+
                                  				   '<a href="javascript:;" style="color:#03A9F5;margin-left:30px;" '+
                                  				   'onclick="ex_remove(\''+typeandkey+'\')">移除</a>'+
                                  			       '</div>';
											   }
											   
											   if ((returndata[i].textNameType)=="多选") {
												   array=   returndata[i].textValue.split('&');
												    if (array.length>0) {
												    	var htmlnext ="";
													    for (var m = 0; m < array.length; m++) {
													    	htmlnext += '<span style="width: 100px;margin-left: 20px;">'+array[m]+'</span>';
														}
											     	}
												    
												    var typeandkey=returndata[i].textNameType +"S"+returndata[i].textNameKey+"S"+cuex_id;
                                                     html +=
                                                   '<div class="m_xcaption" style="line-height:30px;height: auto;margin:0px 0px 0px;">'+
                                                   '<div id="'+returndata[i].textNameType+'" style="display:none"><div id="'+returndata[i].textNameKey+'" style="display:none"></div></div>'+
                                  				   '<span style="color:#999999;width: 100px;margin-left: 20px;">'+returndata[i].textNameKey+':'+'</span>'+
                                  				   htmlnext+
                                  				   '<a href="javascript:;" style="color:#03A9F5;margin-left:30px;" '+
                                  				   'onclick="ex_remove(\''+typeandkey+'\')">移除</a>'+
                                  			       '</div>';
											   }
											   if ((returndata[i].textNameType)=="评分") {
												        if ((returndata[i].textValue)!=""&&(returndata[i].textValue)!=null) {
															var num =parseInt(returndata[i].textValue);
															var htmlnext2 = "";//做num的html封装
															if (num>0) {
																for (var x = 0; x < num; x++) {
																	htmlnext2 += '<img src="<%=path%>/images/star_1.png" style="width: 13px;" class="unSelect">';
																}
															}
															else{
																console.log("转换失败");
															}
														}
												   
												    var typeandkey=returndata[i].textNameType +"S"+returndata[i].textNameKey+"S"+cuex_id;
                                                     html +=
                                                   '<div class="m_xcaption" style="line-height:30px;height: auto;margin:0px 0px 0px;">'+
                                                   '<div id="'+returndata[i].textNameType+'" style="display:none"><div id="'+returndata[i].textNameKey+'" style="display:none"></div></div>'+
                                  				   '<span style="color:#999999;width: 100px;margin-left: 20px;">'+returndata[i].textNameKey+':'+'</span>'+
		                                  			    '<span  style="width: 150px;margin-left: 20px;">'+
		                                  			    htmlnext2+
		         										'<dfn style="margin-left:10px;"  class="pfText">'+returndata[i].textValue+'.0分</dfn>  '+
		         										'<input type="text" value style="display: none;" class="pf" /> '+
		         								     	'</span>  '+
                                  				   '<a href="javascript:;" style="color:#03A9F5;margin-left:30px;" '+
                                  				   'onclick="ex_remove(\''+typeandkey+'\')">移除</a>'+
                                  			       '</div>';
											   }
											   if ((returndata[i].textNameType)=="分割线") {
												      var typeandkey=returndata[i].textNameType +"S"+returndata[i].textNameKey+"S"+cuex_id;
                                                     html +=
                                                   '<div  class="m_xcaption" style="line-height:30px;height: auto;margin:0px 0px 0px;">'+
                                                   '<div id="'+returndata[i].textNameType+'" style="display:none"><div id="'+returndata[i].textNameKey+'" style="display:none"></div></div>'+
                                                   '<span style="display: inline-block;width: 342px;height: 20px;border-bottom: 1px dashed #ddd;margin-left: 18px;"></span>'+
                                  				   '<a href="javascript:;" style="color:#03A9F5;margin-left:30px;" '+
                                  				   'onclick="ex_remove(\''+typeandkey+'\')">移除</a>'+
                                  			       '</div>';
                                  			      
											   }
										}
									}
								$('#show_customer_info_extend').html(html);	//封装
								}
			      			}else {
								alert(客户扩展信息不存在);
							}
	        		  }
	        		  
	        		  }); 
			
		} else {
            alert("客户不存在");
            console.log("找不到客户Id");
         
		}
	}
	
	//判断字符串是否为空
	function StringEmpty(content) {
		if (content == undefined || content == "" || content == null) {
			return false;
		} else {
			return true;
		}
	}
	

	
	//移除扩展信息
	function ex_remove(m){
		//console.log("进入方法");
		//console.log(m);
		var array = new Array();
		array=  m.split("S");
	     var  type=	array[0];
	     var  key = array[1];
	     var  ex_id = array[2];
	     if (type!=null&&type!=""&&key!=null&&key!="") {
	    	 $.ajax({
	       		  url: "<%=path%>/api/custome/removeCustomerectend",

	       		  type: "post",
	       		  
	       		  async: false,

	       		  data:{"type":type,"key":key,"id":ex_id},

	       		  dataType: "json",

	       		  timeout: 1000,

	       		  error: function(){},

	       		  success: function(data){
	       			//console.log("fanhui");
	       		  }
	       		  
	       		  }); 
	    	
	    	 var id_type= "#"+type;var id_key = "#"+key;
	    	
	    	 $(id_type).find(id_key).parents('.m_xcaption').removeClass("show");
	    	 $(id_type).find(id_key).parents('.m_xcaption').addClass("hide");
		}
	}
   </script>
</html>